<?php

namespace app\admin\model\scrm;

use think\Model;


class Visit extends Model
{

    // 表名
    protected $name = 'scrm_visit';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'label_text'
    ];
    
    public function getLabellList()
    {
		$typeList = get_addon_config('scrm')['labeltype'];
        return $typeList;
    } 
    

    public function getLabelTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['label_id']) ? $data['label_id'] : '');
        $list = $this->getLabellList();
        return isset($list[$value]) ? $list[$value] : '';
    }






}
